package com.ssm.supplier.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssm.common.utils.PageUtils;
import com.ssm.common.utils.Query;
import com.ssm.supplier.dao.SsmSupplierDao;
import com.ssm.supplier.entity.SsmSupplierEntity;
import com.ssm.supplier.service.SsmSupplierService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("ssmSupplierService")
public class SsmSupplierServiceImpl extends ServiceImpl<SsmSupplierDao, SsmSupplierEntity> implements SsmSupplierService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key = (String)params.get("key");
        IPage<SsmSupplierEntity> page = this.page(
                new Query<SsmSupplierEntity>().getPage(params),
                new QueryWrapper<SsmSupplierEntity>().like(StringUtils.isNotBlank(key),"dh_name", key)
        );

        return new PageUtils(page);
    }

}